package cn.ikun.mzw;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class AppRef {
    public static void main (String[] args) throws  Exception{

        Class<?> H = Class.forName("cn.ikun.mzw.Human");
        Object o=H.newInstance();

        Field name = H.getDeclaredField("name");
        name.setAccessible(true);
        name.set(o,"段昌旭是狗");

        Method getName = H.getMethod("getName");
        Object result = getName.invoke(o);

        System.out.println(result);
    }
}